import React, {Component} from 'react';
import cs from 'classnames'
import BaseCmpt from '../BaseCmpt';
import './index.css';

class MUeditor extends BaseCmpt {

    static defaultProps = {
        data: {
            type: 11,
            style: {
            },
            dataset: {
                html: ''
            }
        }
    };

    constructor(props) {
        super(props);
    }

    render() {
        var {onSelected, selected, data} = this.props;
        var {style, dataset} = data;
        var {html} = dataset;

        if (!html) {
            html = '<span>请输入富文本内容</span>';
        }

        return (
            <div
                onClick={(e) => {
                    onSelected && onSelected(e)
                }}
                className={cs({'mUeditor cmptEle': true, 'cmptEle_selected': selected})}
                style={style}
                dangerouslySetInnerHTML={{__html: html}}
            >
            </div>
        );
    }
}

export default MUeditor;
